#!/bin/bash

mysql -u root -p <<EOF 
CREATE DATABASE nova; 
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'password'; 
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'127.0.0.1' IDENTIFIED BY 'password'; 
CREATE DATABASE cinder; 
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'password'; 
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'127.0.0.1' IDENTIFIED BY 'password'; 
CREATE DATABASE glance; 
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'password'; 
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'127.0.0.1' IDENTIFIED BY 'password'; 
CREATE DATABASE keystone; 
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'127.0.0.1' IDENTIFIED BY 'password';
CREATE DATABASE dash;
GRANT ALL PRIVILEGES ON quantum.* TO 'dash'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON quantum.* TO 'dash'@'127.0.0.1' IDENTIFIED BY 'password'; 
FLUSH PRIVILEGES;

EOF
